package bishiti;
//单例模式
//懒汉式
public class King {
    private static King k;
    private King(){}
    public static synchronized King getInstance(){
        if (k==null){
            k=new King();
        }
        return k;
    }
}
//饿汉式
//    private static King k=new King();
//    private King(){}
//    public static King getInstance(){
//        return k;
//    }